<template>
  <view class="flex-col">

    <view :class="boole?'bottom115':''">
      <!--基础信息-->
      <batchBasicInfo v-model="detailForm"/>

      <!--  我司购买 批量 我司购买  投保要求-->
      <view class="item-wrap" v-if="Number(detailForm.insuranceChannels) === 1">

        <division-purchase v-model="detailForm" :boole="boole" :insuranceList="insuranceList"
                           ref="refDivisionPurchase"/>

        <view style="margin: 8rpx 20rpx 30rpx 20rpx">
          <uni-forms ref="detailForm" :model="detailForm" :label-position="boole ? 'top' : 'left'" labelWidth="auto">

            <view style="margin-bottom:20rpx">
              <text>保险套餐</text>
            </view>

            <uni-table ref="table" border stripe emptyText="暂无更多数据">
              <uni-tr>
                <uni-th width="70" align="center" v-if="detailForm.addProStatus == 1">操作</uni-th>
                <uni-th width="130" align="center">商业险种</uni-th>
                <uni-th width="120" align="center">保额/万元</uni-th>
              </uni-tr>
              <uni-tr v-for="(item, index) in detailForm.businessList" :key="index">
                <uni-td v-if="detailForm.addProStatus == 1" align="center"
                        style="display: flex;align-items: center;width: fit-content">
                  <view style="display: flex;justify-content: center;align-items: center;height: 100%">
                    <button class="uni-button del-but" size="mini" @click="handleDle( index )" type="warn">删除
                    </button>
                  </view>

                </uni-td>

                <uni-td align="center">
                  <text>{{ item.insuranceProName }}</text>
                </uni-td>

                <uni-td align="center">
                  <view v-if="boole">
                    <uni-easyinput v-if="detailForm.addProStatus == 1" v-model="item.insuranceQuota"/>
                    <text v-if="detailForm.addProStatus == 2">{{ item.insuranceQuota }}</text>
                  </view>
                  <text v-else>{{ item.insuranceQuota }}</text>
                </uni-td>

              </uni-tr>
            </uni-table>

            <view style="display: flex;justify-content: space-between;align-items: center;margin-top:20rpx" v-if="Number(detailForm.addProStatus) === 1 &&
                  detailForm.businessList.length !== dict.type.insurance_project.length && boole">
              <button class="uni-button add-button" v-if="insuranceProName !== ''" size="mini" type="primary"
                      @click="addDecoration">
                添加
              </button>
              <zxz-uni-data-select v-model="insuranceProValue" @change="handleProValue" class="add-uni-data"
                                   :localdata="dict.type.insurance_project" dataKey="label" dataValue="value"
                                   placeholder="请选择商业险种"
                                   ref="refZxzUniDataSelect"
                                   :clear="true" :filterable="false"/>
            </view>
          </uni-forms>
        </view>

        <other v-model="detailForm" :boole="boole"/>
      </view>

      <!--店保 批量  -->
      <view v-if="Number(detailForm.insuranceChannels) === 2">
        <!--交强险信息-->
        <jqx-info v-model="detailForm" :boole="boole" :insuranceList="insuranceList" :options="options"
                  ref="refJqxInfo"/>
        <view class="item-wrap">

          <!--商业险信息-->
          <syx-info v-model="detailForm" :boole="boole" :insuranceList="insuranceList" :options="options"
                    ref="refSyxInfo"/>

          <!--商业险信息 保险套餐-->
          <view style="margin: 8rpx 20rpx 30rpx 20rpx">

            <uni-forms ref="detailForm" :model="detailForm" :label-position="boole ? 'top' : 'left'" labelWidth="auto">

              <view style="margin-bottom:20rpx">
                <text>保险套餐</text>
              </view>

              <uni-table ref="table" border stripe emptyText="暂无更多数据">
                <uni-tr>
                  <uni-th width="130" align="center">商业险种</uni-th>
                  <uni-th width="120" align="center">保额/万元</uni-th>
                  <uni-th width="130" align="center">保险费用/元</uni-th>
                </uni-tr>
                <uni-tr v-for="(item, index) in detailForm.businessList" :key="index">


                  <uni-td align="center">
                    <text>{{ item.insuranceProName }}</text>
                  </uni-td>

                  <uni-td align="center">
                    <uni-easyinput v-if="boole && Number(detailForm.insuranceChannels) === 3"
                                   v-model="item.insuranceQuota"/>
                    <text v-else>{{ item.insuranceQuota }}</text>
                  </uni-td>

                  <uni-td align="center">
                    <uni-forms-item :name="'businessList.'+index+'.insurancePrice'"
                                    :rules="[{ required:boole, errorMessage: '请输入保险费用/元', validateTrigger: 'blur'}]">
                      <uni-easyinput v-if="boole" v-model="item.insurancePrice"
                                     @clear="clear(item,'insurancePrice')"
                                     @blur="blurTable(item,'insurancePrice')"/>
                      <text v-else>{{ item.insurancePrice }}</text>
                    </uni-forms-item>
                  </uni-td>

                </uni-tr>
              </uni-table>


              <uni-forms-item label="商业险保单:" name="syxPolicyUrl" :required="boole"
                              :rules="[{required:true,errorMessage:'上传商业险保单',validateTrigger: 'blur'}]"
                              v-if="detailForm.insuranceVoList.length === 1 && Number(detailForm.insuranceChannels) === 3">
                <image-common :disabled="!boole" :up-type="2" v-model="detailForm.syxPolicyUrl"/>
              </uni-forms-item>

            </uni-forms>
          </view>

        </view>

        <!-- 非车保险 -->
        <other v-model="detailForm" :boole="boole"/>

        <!-- 合计费用-->
        <total-expense v-model="detailForm" :type="2"/>

        <!--  备注 -->
        <remark v-model="detailForm" :boole="boole" ref="refRemark"/>
      </view>

      <!--客户 批量 -->
      <view style="margin: 20rpx" v-if="Number(detailForm.insuranceChannels) === 3">
        <view style="margin-bottom: 20rpx" v-for="(item,index) in detailForm.insuranceVoList">
          <a-collapse ref="refACollapse">
            <template #title>
              <text>{{ item.vinNo || '' }}</text>
            </template>
            <template #content>
              <view class="flex-row align-stretch">
                <view class="flex-col flex1">
                  <view class="text-line">
                    <text class="text-name">品牌车系车型:</text>
                    <text class="text-value">
                      {{ item.brandName|filterNull }}/{{ item.seriesName|filterNull }}/{{ item.modelName|filterNull }}
                    </text>
                  </view>
                  <view class="text-line">
                    <text class="text-name">交强险保单号:</text>
                    <text class="text-value">{{ item.jqxPolicyCode|filterNull }}</text>
                  </view>
                  <view class="text-line">
                    <text class="text-name">交强险起保日:</text>
                    <text class="text-value">{{ item.jqxExpectBeginTime|filterNull }}</text>
                  </view>
                  <view class="text-line">
                    <text class="text-name">交强险到期日:</text>
                    <text class="text-value">{{ item.jqxExpectEndTime|filterNull }}</text>
                  </view>
                  <view class="text-line">
                    <text class="text-name">商业险保单号:</text>
                    <text class="text-value">{{ item.syxPolicyCode|filterNull }}</text>
                  </view>
                  <view class="text-line">
                    <text class="text-name">商业险起保日:</text>
                    <text class="text-value">{{ item.syxExpectBeginTime|filterNull }}</text>
                  </view>
                  <view class="text-line">
                    <text class="text-name">商业险到期日:</text>
                    <text class="text-value">{{ item.syxExpectEndTime|filterNull }}</text>
                  </view>
                  <view class="text-line"
                        style="display: flex;justify-content: flex-end;align-items: center;padding-right: 30rpx">
                    <text style="color: red">合计费用:{{ handleTotalPrice(item) }}</text>
                  </view>
                </view>
              </view>
            </template>
            <template>
              <view>
                <!--交强险信息-->
                <jqxpl-info v-model="detailForm.insuranceVoList[index]" :insuranceList="insuranceList" :boole="boole"
                            :tableList="handleTableList(detailForm.insuranceVoList,index)" :index="index"
                            :ref="`refJqxBatchInfo${index}`"
                            :options="options"/>

                <!--商业险信息-->
                <syxpl-info v-model="detailForm.insuranceVoList[index]" :insuranceList="insuranceList" :boole="boole"
                            :tableList="handleTableList(detailForm.insuranceVoList,index)" :index="index"
                            :ref="`refSyxBatchInfo${index}`"
                            :options="options"/>

                <!--商业险信息 保险套餐-->
                <view style="margin: 0 8rpx">
                  <uni-forms :ref="`detailForm${index}`" :model="detailForm.insuranceVoList[index]"
                             :label-position="boole ? 'top' : 'left'"
                             labelWidth="auto">

                    <view style="margin:20rpx 0 20rpx 10rpx">
                      <text>保险套餐</text>
                    </view>

                    <uni-table ref="table" border stripe emptyText="暂无更多数据">
                      <uni-tr>
                        <uni-th width="70" align="center">操作</uni-th>
                        <uni-th width="130" align="center">商业险种</uni-th>
                        <uni-th width="120" align="center">保额/万元</uni-th>
                        <uni-th width="130" align="center">保险费用/元</uni-th>
                      </uni-tr>
                      <uni-tr v-for="(ite, indexB) in detailForm.insuranceVoList[index].businessList" :key="indexB">

                        <uni-td align="center">
                          <view style="display: flex;justify-content: center;align-items: center;height: 100%">
                            <button class="uni-button del-but" size="mini" v-if="ite.boole"
                                    @click="handleDeleB(  detailForm.insuranceVoList[index].businessList,indexB )"
                                    type="warn">删除
                            </button>
                          </view>
                        </uni-td>

                        <uni-td align="center">
                          <text>{{ ite.insuranceProName }}</text>
                        </uni-td>

                        <uni-td align="center">
                          <uni-easyinput v-if="boole"
                                         v-model="ite.insuranceQuota"/>
                          <text v-else>{{ ite.insuranceQuota }}</text>
                        </uni-td>

                        <uni-td align="center">
                          <uni-forms-item :name="'insuranceVoList[index].businessList.'+indexB+'.insurancePrice'"
                                          :rules="[{ required:boole, errorMessage: '请输入保险费用/元', validateTrigger: 'blur'}]">
                            <uni-easyinput v-if="boole" v-model="ite.insurancePrice"
                                           @clear="clearB(ite,'insurancePrice',detailForm.insuranceVoList[index])"
                                           @blur="blurTableB(ite,'insurancePrice',detailForm.insuranceVoList[index])"/>
                            <text v-else>{{ ite.insurancePrice }}</text>
                          </uni-forms-item>
                        </uni-td>

                      </uni-tr>
                    </uni-table>

                    <view style="display: flex;justify-content: space-between;align-items: center;margin-top:20rpx">

                      <button class="uni-button add-button" v-if="insuranceProName !== ''" size="mini" type="primary"
                              @click="addDecorationB(detailForm.insuranceVoList[index].businessList)">
                        添加
                      </button>
                      <zxz-uni-data-select v-model="insuranceProValue" @change="handleProValue" class="add-uni-data"
                                           :localdata="dict.type.insurance_project" dataKey="label" dataValue="value"
                                           ref="refZxzUniDataSelect"
                                           placeholder="请选择商业险种"
                                           :clear="true" :filterable="false"/>
                    </view>

                    <uni-forms-item label="商业险保单:" name="syxPolicyUrl" :required="boole"
                                    :rules="[{required:true,errorMessage:'上传商业险保单',validateTrigger: 'blur'}]">
                      <text class="syxPolicyUrl"/>
                      <image-common :disabled="!boole" :up-type="2"
                                    v-model="detailForm.insuranceVoList[index].syxPolicyUrl"/>
                    </uni-forms-item>

                  </uni-forms>
                </view>

                <!-- 非车保险 -->
                <otherpl v-model="detailForm.insuranceVoList[index]" :boole="boole"/>

                <!--  备注 -->
                <remarkpl v-model="detailForm.insuranceVoList[index]" :boole="boole"/>

              </view>
            </template>

          </a-collapse>
        </view>

      </view>

    </view>

    <view class="button-container" v-if="boole">
      <button class="btn-item" @click="submit">提 交</button>
    </view>

  </view>
</template>

<script>
import {batchData, newAddInsuranceList} from "@/api/newCarInsure";
import {getInsuranceSelectList} from "@/api/maintain/maintainList";
import batchBasicInfo from "@/pages/CarPage/newCarInsure/components/batchBasicInfo.vue";
import divisionPurchase from "@/pages/CarPage/newCarInsure/components/divisionPurchase.vue";
import jqxInfo from "@/pages/CarPage/newCarInsure/components/jqxInfo.vue";
import syxInfo from "@/pages/CarPage/newCarInsure/components/syxInfo.vue";
import other from "@/pages/CarPage/newCarInsure/components/other.vue";
import remark from "@/pages/CarPage/newCarInsure/components/remark.vue";

import jqxplInfo from "@/pages/CarPage/newCarInsure/components/jqxplInfo.vue";
import syxplInfo from "@/pages/CarPage/newCarInsure/components/syxplInfo.vue";
import otherpl from "@/pages/CarPage/newCarInsure/components/otherpl.vue";
import remarkpl from "@/pages/CarPage/newCarInsure/components/remarkpl.vue";
import totalExpense from "@/pages/CarPage/newCarInsure/components/totalExpense.vue";

export default {
  name: "addBatch",
  dicts: ["insurance_channels", "insurance_project"],
  components: {
    totalExpense,
    batchBasicInfo,
    divisionPurchase,
    jqxInfo,
    syxInfo,
    other,
    remark,
    jqxplInfo,
    syxplInfo,
    otherpl,
    remarkpl,
  },
  computed: {
    insuranceList() {
      return this.dict.type.insurance_channels;
    },
    handleTableList() {
      return function (list, i) {
        return list.filter((item, index) => index !== i);
      }
    },
    handleTotalPrice() {
      return function (val) {
        let num = Math.round(Number(val.jqxAmount) * 100) +
            Math.round(Number(val.carTax) * 100) +
            Math.round(Number(val.syxAmount) * 100) +
            Math.round(Number(val.otherInsuranceSumAmount) * 100)
        return (num / 100).toFixed(2) || 0
      }
    }
  },
  watch: {
    "detailForm.syxPolicyUrl": {
      handler(val) {
        if (val) {
          this.$refs.detailForm.clearValidate(["syxPolicyUrl"]);
        }
      },
      deep: true,
    },
  },
  data() {
    return {
      detailForm: {},
      boole: true,
      insuranceProName: "",
      insuranceProValue: "",
      range: [
        {value: "1", text: "运营"},
        {value: "2", text: "非运营"},
      ],
      options: [],
      totalPrice: 0
    };
  },
  onLoad(op) {
    let id = op.id.split(",");
    this.handleData(id, op?.propertyRightName);
    console.log(op?.propertyRightName)
    this.handleList();
  },
  mounted() {
  },
  methods: {
    async handleData(id, name) {
      try {
        let res = await batchData(id);
        this.detailForm = res.data;
        if (!this.detailForm.syxInsuredName) {
          this.detailForm.syxInsuredName = name || '';
          this.detailForm.insuranceVoList.forEach(item => {
            item.jqxInsuredName = item.syxInsuredName = name;
          });
        }
        if (!this.detailForm.jqxInsuredName) {
          this.detailForm.jqxInsuredName = name || '';
        }
        this.detailForm.workId = id[0]
        console.log(this.detailForm)
      } catch (e) {
        console.error(e);
      }
    },

    //新增保险套餐
    addDecoration() {
      let obj = {
        createBy: null,
        createTime: null,
        delFlag: null,
        id: null,
        insuranceId: null,
        insuranceManageId: null,
        insurancePrice: null,
        insuranceProCode: Number(this.insuranceProValue),
        insuranceProName: this.insuranceProName,
        insuranceQuota: "",
        updateBy: null,
        updateStatus: null,
        updateTime: "",
        boole: true,
      };
      this.detailForm.businessList.push(obj);
      this.insuranceProName = "";
      this.insuranceProValue = "";
      this.$forceUpdate();
    },

    //获取保险公司
    handleList() {
      getInsuranceSelectList({businessTypeCode: "5"}).then((res) => {
        if (res.code === 200) {
          this.options = res.data;
        }
      });
    },

    handleDle(index) {
      this.detailForm.businessList.splice(index, 1);
    },

    blurTable(row, field) {
      let msg = /^(?:[1-9]\d*|0)(?:\.\d+)?$/;
      let _value
      if (row[field]) {
        if (msg.test(Number(row[field]))) {
          if (Number(row[field]) >= 0) {
            _value = row[field].toString().match(/^\d+(?:\.\d{0,2})?/)[0];
            row[field] = _value;
          } else {
            row[field] = "";
          }
        } else {
          row[field] = "";
        }
      }

      let key_ = this.dict.type.insurance_project
          .map((a) => {
            if (Number(row.insuranceProCode) === Number(a.value)) {
              return a.raw.remark;
            }
          })
          .filter((a) => a)[0];
      for (let i = 0; i < this.detailForm.insuranceVoList.length; i++) {
        this.$set(this.detailForm.insuranceVoList[i], key_, row[field]);
      }
      //客户自购计算商业险保费
      if (
          [2, 3].includes(Number(this.detailForm.insuranceChannels)) &&
          field === "insurancePrice"
      ) {
        this.detailForm.syxAmount = this.handleCount();
        this.handleSyxAmount();
      }
    },

    clear(row, field) {
      row[field] = "";
      if (
          [2, 3].includes(Number(this.detailForm.insuranceChannels)) &&
          field === "insurancePrice"
      ) {
        this.detailForm.syxAmount = this.handleCount();
        this.handleSyxAmount();
      }
    },

    handleProValue(val) {
      if (val) {
        const findResult = this.detailForm.businessList.find(
            (a) => Number(a.insuranceProCode) === Number(val.value)
        );

        if (findResult) {
          this.$modal.msgError('商业险种已有,请重新选择');
          this.$refs.refZxzUniDataSelect.clearVal()
          return;
        }

        this.insuranceProValue = val.value;
        this.insuranceProName = val.label;
      }
    },

    //批量客户新增
    addDecorationB(list) {
      let obj = {
        createBy: null,
        createTime: null,
        delFlag: null,
        id: null,
        insuranceId: null,
        insuranceManageId: null,
        insurancePrice: null,
        insuranceProCode: Number(this.insuranceProValue),
        insuranceProName: this.insuranceProName,
        insuranceQuota: "",
        updateBy: null,
        updateStatus: null,
        updateTime: "",
        boole: true,
      };
      list.push(obj);
      console.log(list, 'kokokkoppo')
      this.insuranceProName = "";
      this.insuranceProValue = "";
      this.$forceUpdate();
    },

    handleDeleB(list, index) {
      list.splice(index, 1);
    },

    clearB(row, field, val) {
      row[field] = "";

      let key_ = this.dict.type.insurance_project.find(a => Number(row.insuranceProCode) === Number(a.value))?.raw.remark;
      console.log(key_, row[field], val)

      this.$set(val, key_, row[field]);

      let totalCents = 0;
      totalCents += Math.round(Number(val.szxPrice) * 100);
      totalCents += Math.round(Number(val.ckPrice) * 100);
      totalCents += Math.round(Number(val.jsyPrice) * 100);
      totalCents += Math.round(Number(val.csxPrice) * 100);
      totalCents += Math.round(Number(val.clPrice) * 100);
      totalCents += Math.round(Number(val.hhxPrice) * 100);
      totalCents += Math.round(Number(val.qtPrice) * 100);
      totalCents += Math.round(Number(val.zzfwPrice) * 100);
      this.$set(val, 'syxAmount', (totalCents / 100).toFixed(2));
      this.handleSyxAmount();
    },

    blurTableB(row, field, val) {
      let msg = /^(?:[1-9]\d*|0)(?:\.\d+)?$/;
      let _value
      if (row[field]) {
        if (msg.test(Number(row[field]))) {
          if (Number(row[field]) >= 0) {
            _value = row[field].toString().match(/^\d+(?:\.\d{0,2})?/)[0];
            row[field] = _value;
          } else {
            row[field] = "";
          }
        } else {
          row[field] = "";
        }
      }

      let key_ = this.dict.type.insurance_project.find(a => Number(row.insuranceProCode) === Number(a.value))?.raw.remark;
      console.log(key_, row[field], val)

      this.$set(val, key_, row[field]);

      let totalCents = 0;
      totalCents += Math.round(Number(val.szxPrice) * 100);
      totalCents += Math.round(Number(val.ckPrice) * 100);
      totalCents += Math.round(Number(val.jsyPrice) * 100);
      totalCents += Math.round(Number(val.csxPrice) * 100);
      totalCents += Math.round(Number(val.clPrice) * 100);
      totalCents += Math.round(Number(val.hhxPrice) * 100);
      totalCents += Math.round(Number(val.qtPrice) * 100);
      totalCents += Math.round(Number(val.zzfwPrice) * 100);
      this.$set(val, 'syxAmount', (totalCents / 100).toFixed(2));
      this.handleSyxAmount();
    },


    handleSyxAmount() {
      for (let i = 0; i < this.detailForm.insuranceVoList.length; i++) {
        let totalCents = 0;
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].szxPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].ckPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].jsyPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].csxPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].clPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].hhxPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].qtPrice) * 100);
        totalCents += Math.round(Number(this.detailForm.insuranceVoList[i].zzfwPrice) * 100);

        this.detailForm.insuranceVoList[i].syxAmount = (totalCents / 100).toFixed(2)
      }
    },


    handleCount() {
      let totalCents = 0;
      this.detailForm.syxAmount = 0;
      for (let i = 0; i < this.detailForm.businessList.length; i++) {
        totalCents += Math.round(Number(this.detailForm.businessList[i].insurancePrice) * 100);
      }
      return (totalCents / 100).toFixed(2)
    },

    handleEffect() {
      return new Promise((resolve, reject) => {
        this.$refs?.detailForm
            .validate()
            .then((res) => {
              resolve();
            })
            .catch((err) => {
              let key = ".flex-col" + ">>>" + "." + err[0].key;
              reject(key);
            });
      });
    },

    handleEffectBatch(form, i) {
      return new Promise((resolve, reject) => {
        this.$refs[form][0]
            .validate()
            .then((res) => {
              resolve();
            })
            .catch((err) => {
              let key = ".flex-col" + ">>>" + "." + err[0].key;
              let obj = {
                e: key,
                i: i
              }
              reject(obj);
            });
      });
    },

    async submit() {
      let effectPromises;
      const channels = Number(this.detailForm.insuranceChannels);
      ([1, 2]).includes(channels) ? effectPromises = [this.handleEffect()] : effectPromises = []
      if (channels === 1) {
        effectPromises.push(this.$refs.refDivisionPurchase?.handleEffect());
      } else if (channels === 2) {
        effectPromises.push(
            this.$refs.refJqxInfo?.handleEffect(),
            this.$refs.refSyxInfo?.handleEffect(),
            this.$refs.refRemark?.handleEffect()
        )
      } else if (channels === 3) {
        this.detailForm.insuranceVoList.forEach((item, index) => {
          let jqx = `refJqxBatchInfo${index}`
          let syx = `refSyxBatchInfo${index}`
          let bx = `detailForm${index}`
          effectPromises.push(
              this.$refs[jqx][0]?.handleEffect(),
              this.$refs[syx][0]?.handleEffect(),
              this.handleEffectBatch(bx, index)
          )
        })

      }
      try {
        await Promise.all(effectPromises);
        uni.showLoading();
        const res = await newAddInsuranceList(this.detailForm);
        if (res && res.code === 200) {
          uni.$emit("refBackList", true);
          this.$modal.msgSuccess("提交成功");
          setTimeout(() => {
            this.$tab.navigateBack();
          }, 1000);
        } else {
          this.$modal.msgError("提交失败");
        }
      } catch (error) {
        if (channels === 3) {
          if (typeof error.e === "string") {
            this.$nextTick(() => {
              uni.pageScrollTo({
                selector: error.e,
              });
            });
            this.$refs.refACollapse[error.i].changeStatus(true)
          }
        } else {
          if (typeof error === "string") {
            this.$nextTick(() => {
              uni.pageScrollTo({
                selector: error,
              });
            });
          } else {
            this.$modal.msgError(error);
          }
        }

      } finally {
        setTimeout(() => {
          uni.hideLoading()
        }, 1000)
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.add-button {
  margin-right: 20rpx;
}

.add-uni-data {
  flex: 1;
}

.del-but {
  padding-right: 20rpx;
  padding-left: 20rpx;
}
</style>


